home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / LOCMOD1.MOD < prev    next >
Text File  |  1989-01-18  |  1KB  |  47 lines

  1.                                         (* Chapter 13 - Program 1 *)
  2. MODULE LocMod1;
  3.  
  4. FROM InOut IMPORT WriteString, WriteCard, WriteLn;
  5.  
  6. VAR Index : CARDINAL;
  7.  
  8.        MODULE LocalStuff;
  9.        EXPORT GetNumber;    (* Nothing else is visible outside *)
  10.                             (* Nothing outside is visible here *)
  11.        VAR Counter : CARDINAL;
  12.  
  13.               PROCEDURE GetNumber() : CARDINAL;
  14.               BEGIN
  15.                  Counter := Counter + 3;
  16.                  RETURN Counter;
  17.               END GetNumber;
  18.  
  19.        BEGIN
  20.        Counter := 4;    (* This is only run at load time *)
  21.        END LocalStuff;
  22.  
  23. BEGIN      (* Main program *)
  24.    FOR Index := 1 TO 8 DO
  25.       WriteString("The count is now ");
  26.       WriteCard(GetNumber(),8);
  27.       WriteLn;
  28.    END;    (* Do loop *)
  29. END LocMod1.
  30.  
  31.  
  32.  
  33.  
  34. (* Result of execution
  35.  
  36. The count is now       7
  37. The count is now      10
  38. The count is now      13
  39. The count is now      16
  40. The count is now      19
  41. The count is now      22
  42. The count is now      25
  43. The count is now      28
  44.  
  45. *)
  46.  
  47.